//package com.guli.base.code.controller;
//
//import com.guli.common.dto.R;
//import com.guli.common.utils.EncryptUtils;
//import com.guli.common.utils.ImageUtils;
//import com.guli.common.utils.RandomUtils;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//@RestController
//@RequestMapping("/base/code")
//public class CaptchaController {
//    @GetMapping("/captcha")
//    public R<String> getCaptcha(){
//        String codeStr = RandomUtils.generateCode(4);
//        byte[] binary = ImageUtils.generateCaptcha(codeStr);
//        //转为base64
//        String base64Str = EncryptUtils.toBase64String(binary);
//        return R.ok("返回的是一个base64加密的二进制文件" + base64Str);
//    }
//
//}
